<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>我的订单</title>
    <link rel="stylesheet" href="../css/bootstrap.min.css">
    <link rel="stylesheet" href="../layui/css/layui.css" media="all">
    <link rel="stylesheet" href="../css/main.css">
    <link rel="stylesheet" href="../css/dd.css">
</head>
<body>
<div class="container-fluid" style="background-color: white">
    <iframe src="../html/head.html" width="100%" height="260px" scrolling="no" name="iframe名称" style="border: 0">
    </iframe>

    <div class="item-headers" id="orderDesc_orderDesc_1">
        <div class="header-wrapper ">
            <h2 class="header-title">我的订单信息</h2>
        </div>
        <div class="item-headers-wrap item-headers-column-6">
            <div class="item-headers-content item-headers-0">店铺宝贝</div>
            <div class="item-headers-content item-headers-1">商品属性</div>
            <div class="item-headers-content item-headers-2">单价</div>
            <div class="item-headers-content item-headers-3">数量</div>
            <div class="item-headers-content item-headers-4">发货状态</div>
            <div class="item-headers-content item-headers-5">收货人地址</div>
        </div>
    </div>
    <div class="dinamicx-card-group" id="order">
        <div class="seller">
            <div class="order-orderInfo">
                <img src="//img.alicdn.com/tps/i2/TB1wopUHVXXXXXyXpXXAAT2HVXX-63-63.png" class="shopIcon">
                <span class="shop-name">
                  店铺
                  :&nbsp
              </span>
                <a href="//store.taobao.com/shop/view_shop.htm?shop_id=112441448" target="_blank"
                   rel="noopener noreferrer" title="君君在韩国" class="order-link shop-url">火云鞋神</a>
                <span class="shop-seller">
                  卖家
                  :&nbsp
              </span>
                <a href="#">烦躁ing</a>
            </div>
        </div>

        <!--<div >
        <div class="order-itemInfo">
            <div class="info-detail info-cell">
                <a href="#" target="_blank" rel="noopener noreferrer" class="order-link info-cell">
                    <img class="info-img"
                         src="//img.alicdn.com/imgextra/i2/231994019/O1CN01SuZKLW1fYkOYJ1W62_!!231994019.jpg_100x100q90.jpg"
                         alt="">
                </a>
                <div class="info-cell info-msg">
                    <a href="#" target="_blank" rel="noopener noreferrer" class="order-link info-title">
                        MAC/魅可2020新款磨砂柔雾哑光唇釉991/989/988/998/984/997
                    </a>
                    <div class="info-icon-list">
                        <div>
                            <a href="//www.taobao.com/go/act/315/you.php" target="_blank" rel="noopener noreferrer"
                               title="如实描述 - 消费者保障服务，卖家承诺商品如实描述" class="order-link icon-main">
                                <img src="//gtd.alicdn.com/tps/i4/T1pegvFrBdXXaSQP_X-16-16.png" alt="">
                            </a>
                        </div>
                        <div>
                            <p class="icon-ext">
                                支持7天无理由
                                <a href="//service.taobao.com/support/knowledge-5701303.htm" target="_blank"
                                   rel="noopener noreferrer" class="order-link ext-detail-msg">详情</a>
                            </p>
                        </div>
                    </div>
                    <span class="delivery-time">
                    发货时间：
                    付款后3天内
                </span>
                </div>
            </div>
            <div class="info-sku info-cell">
                <p>
                <span class="hd">
                    颜色分类:
                </span>
                    <span class="bd">997#over the taupe[限时折折中！！]</span>
                </p>
            </div>
            <div class="info-price info-cell">195.00</div>
        </div>
        <div class="order-quantity">
            <div class="quantity-inner">
                <p>1</p>
            </div>
        </div>
        <div class="item-row__select">
            <p>满200减20</p>
        </div>
        <div class="item-row__price">
            <div class="label item-row__price-item">
                <span style="font-weight: bold; font-style: normal; text-decoration: none; color: rgb(255, 68, 0); font-size: 14px; min-width: 100px;">195.00</span>
            </div>
        </div>
        </div>-->

        <div style="padding: 0px; border-top: 1px solid rgb(255, 255, 255); width: 1000px;height: 91px;background-color: #5bc0de"></div>
    </div>
</div>
<script src="../js/jquery-3.3.1.min.js"></script>
<script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdn.bootcss.com/jquery-cookie/1.4.1/jquery.cookie.js"></script>
<script src="../js/cookie.js"></script>
<script src="../layui/layui.js" charset="utf-8"></script>
<script>
    var a = getCookie("userid")
    console.log(a)

    var search = location.search
    console.log(search)


    $.getJSON("http://localhost:8080/selectByOrderId?userId=" + a, function (data) {
        console.log(data)
        for (let i = 0; i < data.length; i++) {
            var html = ''
            html += `
        <div >
        <div class="order-itemInfo">
            <div class="info-detail info-cell">
                <a href="#" target="_blank" rel="noopener noreferrer" class="order-link info-cell">
                    <img class="info-img"
                         src="${data[i].goodPhoto}"
                         alt="">
                </a>
                <div class="info-cell info-msg">
                    <a href="#" target="_blank" rel="noopener noreferrer" class="order-link info-title">
                        ${data[i].goodName}
                    </a>
                    <div class="info-icon-list">
                        <div>
                            <a href="//www.taobao.com/go/act/315/you.php" target="_blank" rel="noopener noreferrer"
                               title="如实描述 - 消费者保障服务，卖家承诺商品如实描述" class="order-link icon-main">
                                <img src="//gtd.alicdn.com/tps/i4/T1pegvFrBdXXaSQP_X-16-16.png" alt="">
                            </a>
                        </div>
                        <div>
                            <p class="icon-ext" style="font-size: 13px">
                                支持7天无理由
                                <a href="http://localhost:63343/qiguai/cart/evalute.html?orderno=${data[i].orderNo}" target="_blank"
                                   rel="noopener noreferrer" class="order-link ext-detail-msg">评价</a>
                                   <a id="appAftSale" name="${data[i].orderId}">申请售后</a>
                            </p>
                        </div>
                    </div>
                    <span class="delivery-time">
                    发货时间：
                    付款后3天内
                </span>
                </div>
            </div>
            <div class="info-sku info-cell">
                <p>
                <span class="hd">
                    鞋码大小:
                </span>
                    <span class="bd">${data[i].reserve3}</span>
                </p>
            </div>
            <div class="info-price info-cell">${data[i].goodMoney}</div>
        </div>
        <div class="order-quantity">
            <div class="quantity-inner">
                <p>${data[i].orderCount}</p>
            </div>
        </div>
        <div class="item-row__select">
            <p>${data[i].orderState}</p>
        </div>
        <div class="item-row__price" style="width: 20px">
            <div class="label item-row__price-item" >
                <span style="font-weight: bold; font-style: normal; text-decoration: none; color: rgb(255, 68, 0); font-size: 9px; min-width: 140px;word-wrap: break-word;white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;">${data[i].reserve2}</span>
            </div>
        </div>

        <form name=alipayment action="http://localhost:8080/pay"  method=post
              target="_top">
            <div class="show" name="divcontent">
                <dl class="content">
                    <dt style="float: left">商户订单号 ：</dt>
                    <dd style="float: left">
                        <input id="WIDout_trade_no" name="WIDout_trade_no" readonly value="${data[i].orderNo}"/>
                    </dd>
                    <dt style="float: left;margin-left: 50px">付款金额 ：</dt>
                    <dd>
                        <input id="WIDtotal_amount" name="WIDtotal_amount" readonly value="${data[i].orderMoney}" />
                    </dd>
                    <dd style="display: none">
                        <input id="WIDbody" name="WIDbody" value="${data[i].orderNo}"/>
                    </dd>
                    <dd style="display: none">
                        <input id="WIDsubject" name="WIDsubject" value="${data[i].orderNo}"/>
                    </dd>

                    `

            if (data[i].orderState == "未付款") {
                // clock(data[i].orderDate)
                $.cookie("djsendtime",data[i].orderDate);
                $.cookie("djsendNo",data[i].orderNo);
                html += `


                    <dd id="btn-dd">
						<span class="new-btn-login-sp">
							<button class="new-btn-login" type="submit"
                                   style="text-align: center;float: right;position: relative;top:-30px">去 付 款</button>
                            <div style="float: right">剩余付款时间：<span id="spanTime" ><input type="text" id="clock" /></span></div>
						</dd>
						`
            }
            html += `
                </dl>
            </div>
        </form>
        </div>
        `
            $("#order").append(html)
        }
        // clock(${data[i].orderDate})
    })

    var layer
    var form

    layui.use(['form', 'jquery', 'layer'], function () {

        form = layui.form;
        layer = layui.layer;
    })

    $('body').on('click', '#appAftSale', function () {
        let aftOrderId = $(this).attr("name")
        $.getJSON("http://localhost:8080/user/selectUAftHave?aftOrderId=" + aftOrderId, function (data) {
            if (data.code === 0) {
                layer.msg('亲，该订单已提交过售后申请了嗷')
                aftOrderId = -1
            } else {
                window.location.href = 'http://localhost:63343/qiguai/html/uaftapply.html?' + aftOrderId
            }
        })
    })


</script>
<script type="text/javascript" >
    var int=self.setInterval("clock()",1000);
    function clock()
    {
        var d=new Date();
        var djsendtime = $.cookie("djsendtime");
        var f = new Date(djsendtime)
        // console.log(f.getTime())
        // var t=d.toLocaleTimeString();
        var t =(15*60*1000) - (d.getTime()-f.getTime())
        var y = new Date(t)

        var orderNo = $.cookie("djsendNo");
        document.getElementById("clock").value=y.getMinutes()+":" +y.getSeconds()
        var z = document.getElementById("clock").value
        if(z == "0:0"){
            // document.getElementById("clock").value =="0:0"
            clearInterval(int);
            document.getElementById("clock").value =="0:0"
            $.getJSON("http://localhost:8080/deleteByorderNo?orderNo="+ orderNo ,function (data) {
            })
        }
    }

    if(search == "?2"){
        layer.msg('您超过订单时间，订单已被删除了！')
    }




</script>
</body>
</html>